package Exercise2;
//定义数组存储3个商品对象
//商品的属性:id,名字，价格，库存
//创建三个商品对象，并把商品对象存入到数组当中
public class GoodsTest {
    public static void main(String[] args) {
        Goods[] arr = new Goods[3];
        Goods g1 = new Goods("001","华为p60",6000,50);
        Goods g2 = new Goods("002","保温杯",100,120);
        Goods g3 = new Goods("003","热水袋",20,1150);

        arr[0] = g1;
        arr[1] = g2;
        arr[2] = g3;

        for (int i = 0; i < arr.length; i++) {
            Goods goods = arr[i];
            System.out.println(goods.getId()+","+goods.getName()+","+goods.getPrice()+","+goods.getCount());
        }
    }
}
